package untiring.beans;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import untiring.interfaces.CommentDAO;
import untiring.models.CommentVO;

@Repository("commentDAO")
public class CommentDAOImpl 
									implements CommentDAO {

	@Autowired
	private SqlSession sqlSession;
	
	@Override
	public boolean insertComment(CommentVO c) {
		boolean result = false;
		if (sqlSession.insert(
				"commentMapper.insertComment", c)>0)
			result = true;
		return result;
	}

	@Override
	public List<CommentVO> selectComment(String bno) {
		return sqlSession.selectList(
				"commentMapper.selectComment", bno);
	}

	@Override
	public boolean insertReply(CommentVO c) {
		boolean result = false;
		if (sqlSession.insert(
				"commentMapper.insertReply", c)>0)
			result = true;
		return result;
	}
	
}





